﻿#region

using System;
using System.Threading;
using System.Windows;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Minion.Win.Client.Constants;

#endregion

namespace Minion.Win.Client
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            Thread.Sleep(3000);
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            BuildLocalizedApplicationBar();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            App.Mode = Mode.RealTime;
            NavigationService.Navigate(new Uri("/Views/LocationItemList.xaml", UriKind.RelativeOrAbsolute));
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            App.Mode = Mode.Demo;
            NavigationService.Navigate(new Uri("/Views/LocationItemList.xaml", UriKind.RelativeOrAbsolute));
        }

        // Sample code for building a localized ApplicationBar
        private void BuildLocalizedApplicationBar()
        {
            // Set the page's ApplicationBar to a new instance of ApplicationBar.
            ApplicationBar = new ApplicationBar();

            // Create a new button and set the text value to the localized string from AppResources.
            var appBarButton =
                new ApplicationBarIconButton(new Uri("/Assets/AppBar/feature.settings.png", UriKind.Relative));
            appBarButton.Text = "Settings";
            appBarButton.Click += appBarMenuItem_Click;
            ApplicationBar.Buttons.Add(appBarButton);

            // Create a new menu item with the localized string from AppResources.
            //ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem("Settings");
            //appBarMenuItem.Click += appBarMenuItem_Click;
            //ApplicationBar.MenuItems.Add(appBarMenuItem);
        }

        private void appBarMenuItem_Click(object sender, EventArgs e)
        {
            NavigationService.Navigate(new Uri("/Views/settingsPage.xaml", UriKind.RelativeOrAbsolute));
        }
    }
}